File attechment submodel - #193
Merged
Merged
Conversation
…nhance asset ID queries
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactor the return statement in `SubmodelRepositoryService.cs` to use the C# 8.0 range operator for improved collection handling. Add comprehensive unit tests in `GetAllSubmodelsControllerTests.cs` to cover various scenarios for the `GetAllSubmodelsAsync` method, including handling of query parameters, paging, and exception cases. Utilize `NSubstitute` for mocking and `Xunit` for test structuring.
…th semaphore and add configuration for concurrent operations limit
Introduce `_templateManagementOptions` in `SubmodelRepositoryServiceTests` to configure `TemplateManagementConfig` with a `ServiceInstance` and `ConcurrentOperationsLimit`. Update the constructor of `SubmodelRepositoryService` to include the new parameter. Add necessary using directives for configuration and options handling.
…tAllSubmodelsAsync functionality and improve request handling
…mplateAsync and adjust request paths
…SubmodelTemplateAsync for improved query handling
…cluding adjustments to semaphore release and data structure initialization.
…load endpoint; improve response descriptions; correct max file attachment size in configuration files.
- Implemented tests for FileAttachmentStreamProvider to verify response headers and content stream reading. - Added tests for MaxLengthStream to ensure it correctly enforces maximum byte limits and throws exceptions when exceeded. - Refactored SubmodelRepositoryHandler to streamline file attachment retrieval logic. - Updated FileSizeExceededException and InvalidFileUrlException to simplify constructors and messages. - Introduced MaxLengthStream class to limit stream reading to a specified byte size. - Modified SubmodelRepositoryService to enhance file URL validation and response handling. - Updated JSON test data to remove Google Docs viewer URLs in favor of direct file URLs. - Adjusted SQL load script to reflect changes in document URL handling.
… invalid file element types and empty file URLs.
mm-kgi
reviewed
Aug 3, 2026
…erface and FileContentProvider class; update SubmodelRepositoryService to use new provider; add unit tests for MaxLengthStream and FileContentProvider.
…r; update exception classes by removing unnecessary comments and whitespace.
…mResult, FileAttachmentResult, and FileContentResponse classes; refactor SubmodelRepositoryService and related components; update exception handling for file size limits; remove obsolete exceptions.
…ControllerTests and SubmodelRepositoryHandlerTests to use new FileContentResponse and LimitedFileStreamResult; adjust assertions and exception handling for improved clarity and accuracy.
…od to return FileStreamResult instead of LimitedFileStreamResult; modify related unit tests for consistency and clarity.
Renamed FileStreamResult to FileContentStreamResult and updated all references, including controller logic and tests, to ensure consistent handling of file attachments with the new result type.
…SuccessStatusCode with explicit check for success status and throw InternalDataProcessingException on failure.
…ests and update exception handling to throw InvalidUserInputException with specific messages.
mm-kgi
previously approved these changes
Aug 6, 2026
…dating status code and message retrieval into GetErrorDetails method.
…solidating return statements for clarity.
…tLength and contentType parameters; update related usages in FileContentProvider and tests.
|
Test & Coverage ReportTest Results Summary
Code CoverageUnit Tests Coverage
Minimum allowed line rate is Module Tests Coverage
|
mm-asha
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This pull request introduces comprehensive tests for the new file attachment streaming functionality in the Submodel Repository API, along with related dependency and test setup updates. The main focus is on ensuring that file attachments (such as images or documents) can be retrieved, streamed, and handled securely and correctly, including error handling for edge cases. Several test classes are updated to support and validate these features.
File Attachment Streaming and Testing Enhancements:
SubmodelRepositoryControllerTests.cs:IFileAttachmentStreamProviderdependency to support file streaming in tests.SubmodelRepositoryHandlerTests.cs:SubmodelRepositoryControllerTests.cs(Unit Tests):FileStreamResultand passes route values to the handler when serving file attachments.Dependency Injection and Test Setup:
IFileAttachmentStreamProviderwhere required.Test Data and Configuration Updates:
Minor Fixes and Code Quality:
These changes significantly improve test coverage for file attachment streaming and ensure the new functionality is robust, secure, and well-integrated with the existing API and service infrastructure.